﻿using System.Reflection;
using System.Runtime.Loader;

namespace YaAppoint.RoslynCompiler
{
    /// <summary>
    /// 动态程序集加载上下文
    /// </summary>
    public class DynamicAssemblyLoadContext: AssemblyLoadContext
    {
        public DynamicAssemblyLoadContext():base(isCollectible:true) // 可以被GC回收
        {
           
        }

        protected override Assembly? Load(AssemblyName assemblyName)
        {
            // 依赖加载策略一： 让默认ALC处理当前动态编译ALC的所有依赖
            return null;
        }
    }
}
